package com.bayihouse.model.vo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.bayihouse.model.entity.OutPerson;
import com.bayihouse.utils.MyDateUtils;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;

@Data
public class OutPersonVO implements Serializable {
    private static final long serialVersionUID = -5020554138051846374L;
    /**
     * 外来人员Id
     */
    private Long id;

    /**
     * 外来人员姓名
     */
    private String name;

    /**
     * 外来人员电话
     */
    private String telephone;

    /**
     * 0-代表女生，1-代表男生
     */
    private String sex;

    /**
     * 登记时间
     */
    private String createtime;

    /**
     * 目的地
     */
    private String destination;

    /**
     * 事由
     */
    private String reason;


    private String status;

    private String roomName;


    public static OutPersonVO objToVo(OutPerson outperson) {
        OutPersonVO outPersonVO = new OutPersonVO();
        BeanUtils.copyProperties(outperson, outPersonVO);
        outPersonVO.setCreatetime(MyDateUtils.dateToString(outperson.getCreatetime()));
        outPersonVO.setSex(outperson.getSex() == 0 ? "女" : "男");
        outPersonVO.setStatus(outperson.getStatus() == 0 ? "未办暂住证" : "已办暂住证");
        return outPersonVO;
    }
}
